home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 42 / Amiga Format AFCD42 (Issue 126, Aug 1999).iso / -serious- / hardware / blizkick / modules / ramlibstack.asm < prev    next >
Assembly Source File  |  1999-05-17  |  2KB  |  100 lines

  1. ; FILE: Source:modules/ramlibstack.ASM          REV: 2 --- make ramlib stack 8k
  2.  
  3. ;
  4. ; Make ramlib stack 8k
  5. ; ~~~~~~~~~~~~~~~~~~~~
  6. ; This module hacks ramlib initialization so that it will allocate
  7. ; 8k stack instead of original 2k. Substitutes MCPRamlibPatch.
  8. ;
  9. ; Written by Harry Sintonen.
  10. ; This source code is Public Domain.
  11. ;
  12.  
  13.     incdir    "include:"
  14.     include    "blizkickmodule.i"    ; Some required...
  15.  
  16.     SECTION    PATCH,CODE
  17. _DUMMY_LABEL
  18.     BK_PTC
  19.  
  20. ; Code is run with following incoming parameters:
  21. ;
  22. ; a0=ptr to ROM start (buffer)    eg. $1DE087B8
  23. ; a1=ptr to ROM start (ROM)    eg. $00F80000 (do *not* access!)
  24. ; d0=ROM lenght in bytes    eg. $00080000
  25. ; a2=ptr to _FindResident routine (will search ROM buffer for resident tag):
  26. ;    CALL: jsr (a2)
  27. ;      IN: a0=ptr to ROM, d0=rom len, a1=ptr to resident name
  28. ;     OUT: d0=ptr to resident (buf) or NULL
  29. ; a3=ptr to _InstallModule routine (can be used to plant a "module"):
  30. ;    CALL: jsr (a3)
  31. ;      IN: a0=ptr to ROM, d0=rom len, a1=ptr to module, d6=dosbase
  32. ;     OUT: d0=success
  33. ; a4=ptr to _Printf routine (will dump some silly things (errormsg?) to stdout ;-)
  34. ;    CALL: jsr (a4)
  35. ;      IN: a0=FmtString, a1=Array (may be 0), d6=dosbase
  36. ;     OUT: -
  37. ; d6=dosbase, a6=execbase
  38. ;
  39. ; Code should return:
  40. ;
  41. ; d0=true if succeeded, false if failed.
  42. ; d1-d7/a0-a6 can be trashed. a7 *must* be preserved! ;-)
  43.  
  44.     cmp.w    #37,($C,a0)
  45.     bhs.b    .cont
  46.     moveq    #0,d0
  47.     rts
  48.  
  49. .cont    movem.l    d0/a0-a1,-(sp)
  50.  
  51.     lea    (ramlibname,pc),a1
  52.     jsr    (a2)
  53.     tst.l    d0
  54.     beq    .fail
  55.     move.l    d0,a5
  56.  
  57.     move.l    a5,a0            ; a0=beg of search
  58.     lea    (2048,a0),a1        ; a1=end of search
  59.  
  60.     move.l    #$2608E48B,d1
  61.     move.l    #$7808E19C,d2
  62.     move.l    #$4EAEFF76,d3
  63.  
  64. .find    addq.l    #2,a0
  65.     cmp.l    a1,a0
  66.     bhs.b    .not_found
  67.     cmp.l    (a0),d1
  68.     bne.b    .find
  69.     cmp.l    (4,a0),d2
  70.     bne.b    .find
  71.     cmp.l    (8,a0),d3
  72.     bne.b    .find
  73.  
  74.     move.w    #$7820,(4,a0)
  75.     moveq    #1,d0
  76.     bra.b    .noerr
  77.  
  78. .not_found    move.l    (RT_IDSTRING,a5),a0
  79.     sub.l    (2*4,sp),a0        ;[a1]
  80.     add.l    (1*4,sp),a0        ;[a0]
  81.     move.l    a0,-(sp)
  82.     move.l    sp,a1
  83.     lea    (fmt1,pc),a0
  84.     jsr    (a4)
  85.     addq.l    #4,sp
  86.  
  87. .fail    moveq    #0,d0
  88. .noerr    lea    (3*4,sp),sp
  89.     rts
  90.  
  91.  
  92. ramlibname    dc.b    'ramlib',0
  93. fmt1    dc.b    'Couldn''t patch %s',0
  94.  
  95.  
  96.     SECTION    VERSION,DATA
  97.  
  98.     dc.b    '$VER: ramlibstack_PATCH 1.0 (19.10.98)',0
  99.  
  100.